package com.chinasoft.ssm.mapper;

import com.chinasoft.ssm.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserInfoMapper {

    @Select("select * from user where username = #{username}")
    User selectByName(String name);
    @Select("select * from user")
    List<User> selectall();
     @Select("select  * from user where id=#{id}")
    User selectById(int id);
    @Update("update user set name = #{name} , sex = #{sex}" +
            "" +
            "" +
            "" +
            "" +
            ", address = #{address}, phone = #{phone} ,img=#{img} where id = #{id} ")
    Integer update(User user);
    @Delete("delete from user where id = #{id} ")
    Integer delete(Integer id);

    List<User> selectByDSql(User user);

    @Insert("insert into user values(null,#{sex},#{name},#{address},#{phone}," +
            "#{password},#{img},#{username})")
    Integer add(User user);
}
